import 'dart:io';

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_base_plugin/base_library/base/base_function.dart';
import 'package:flutter_base_plugin_example/page/mine/mine_head.dart';
import 'package:flutter_base_plugin_example/page/mine/vm/mine_view_model.dart';

import '../../config/k_color.dart';
import '../../dialog/common_dialog.dart';
import '../../widgets/jd_button.dart';

class MinePage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return _minePageState();
  }
}

class _minePageState extends BaseProviderState<MineViewModel, MinePage> {
  @override
  void buildCreate() {
    // TODO: implement buildCreate
    // TODO: implement onCreate
    if(Platform.isAndroid){
      // CommonUtils.showToast("android");
      bottomVertical = 56;

    }else{
      // CommonUtils.showToast("ios");
      bottomVertical = 92;
    }
  }

  @override
  MineViewModel buildViewModel() {
    // TODO: implement buildViewModel
    return MineViewModel();
  }

  @override
  Widget buildWidget(MineViewModel viewModel, BuildContext context) {
    // TODO: implement buildWidget
    return Container(
      color: KColors.white,
      child: SingleChildScrollView(
        child: Column(
          children: [
            MineHead(context),
            ListTile(
              leading: Icon(Icons.assignment, color: Colors.red),
              title: Text("全部订单"),
              onTap: () {
                // loginPushPage(RouterPath.Order);
              },
            ),
            Divider(thickness: 2.h),
            ListTile(
              leading: Icon(Icons.payment, color: Colors.green),
              title: Text("待付款"),
            ),
            Divider(thickness: 2.h),
            ListTile(
              leading: Icon(Icons.local_car_wash, color: Colors.orange),
              title: Text("待收货"),
            ),
            Container(
              width: getScreenWidth(),
              height: 10,
              color: KColors.tf8f8f8,
            ),
            ListTile(
              leading: Icon(Icons.favorite, color: Colors.lightGreen),
              title: Text("我的收藏"),
            ),
            Divider(thickness: 2.h),
            ListTile(
              leading: Icon(Icons.add_business, color: Colors.lightGreen),
              title: Text("收货地址"),
              onTap: () {
                // loginPushPage(RouterPath.AddressList);
              },
            ),
            Divider(thickness: 2.h),
            ListTile(
              leading: Icon(Icons.people, color: Colors.black54),
              title: Text("在线客服"),
            ),
            Divider(thickness: 2.h),
            JdButton(
              text: "退出登录",
              onClick: () {
                CommonDialog.loginOutDialog(
                  context,
                      () {
                    // model.loginOut();
                  },
                );
              },
            )

          ],
        ),
      ),
    );
  }
}
